﻿@{
    Layout = "~/_SiteLayout.cshtml";
    Page.CustStatus = RefDataManager.GetCustStatLkUpVal();
    Page.CustClass = RefDataManager.GetCustClassLkUpVal();
    Page.Region = RefDataManager.GetRegionLkUpVal();
    Page.CustGender = RefDataManager.GetGenderLkUpVal();
    Page.Nationality = RefDataManager.GetNatLkUpVal();
    Page.CustIdType = RefDataManager.GetIDTypeLkUpVal();
    Page.SrcOfFund = RefDataManager.GetSrcOfFundsLkUpVal();
    Page.EmpType = RefDataManager.GetEmpTypeLkUpVal();
    Page.CCStatus = RefDataManager.GetCashCardStatLkUpVal();
    Page.CCDocStatus = RefDataManager.GetDocStatLkUpVal();
    Page.CCType = RefDataManager.GetCashCardTypeLkUpVal();
    Page.CCPartnerBank = RefDataManager.GetPartnerBankLkUpVal();
    Page.CCDelStatus = RefDataManager.GetCardDelLkUpVal();
    Page.Solicitor = RefDataManager.GetSolicitorLkUpVal();
    Page.Rel2Ref = RefDataManager.GetRel2RefLkUpVal();
    Page.Campaign = RefDataManager.GetCampaignLkUpVal();
    Page.Month = RefDataManager.GetMonthLkUpVal();
    Page.Year = RefDataManager.GetYearLkUpVal();
    Page.CivilStatus = RefDataManager.GetCivilStatLkUpVal();
    Page.IDType = RefDataManager.GetIDTypeLkUpVal();
    Page.DesigRank = RefDataManager.GetDesRankLkUpVal();
    Page.NatureOfWork = RefDataManager.GetNatureOfWorkLkUpVal();
    Page.ModeOfRemit = RefDataManager.GetModeOfRemitLkUpVal();
    Page.CallFreq = RefDataManager.GetCallFreqLkUpVal();
    Page.CargoFreq = RefDataManager.GetCargoFreqLkUpVal();
    Page.RemitFreq = RefDataManager.GetRemitFreqLkUpVal();
    Page.ModeOfCall = RefDataManager.GetPrefModeOfComLkUpVal();
    Page.PrefModeOfComm = RefDataManager.GetPrefModeOfComLkUpVal();
    Page.PrefDayOfCall = RefDataManager.GetPrefDayLkUpVal();
    Page.PrefTimeOfCall = RefDataManager.GetPrefTimeLkUpVal();
    Page.RefBy = CustomerManager.GetAllCustomers();
    //
   
    var custId=(Page.CustomerID!=null)?Page.CustomerID:string.Empty;
    var customer = (Page.Customer!=null)?Page.Customer:new Customer();
    
        
    
}
<script>
    $(document).ready(function(){
        if(@Page.Mode=='1'){
            $('#tabs :input').attr('disabled',true);
        }
        
       wireEvents();   
       
    });
    
  
  
    
    
    
   function wireEvents(){
    //datepicker
    $("#datepicker").datepicker({
          changeMonth:true,
          changeYear:true,
          showButtonPanel:true,
          minDate: new Date(1950,1-1,1),
          maxDate: new Date(2012,12-1,31)
        }); 
        
   //dialog box
     $("#dialog").dialog({
         autoOpen:false,
         modal:true,
         resizable:false,
         draggable:false,
         position:"center",
         buttons:{
             "Yes, I do":function(){
                     
                     $("#custForm").submit();
                   },
             "No":function(){
                     $("#dialog").dialog("close");
                     $("#custForm").preventDefault();
            }
        }
        });
    ///  
     //save button  
      $("#addCustomer").click(function(){
           $("#dialog").dialog("open");
            $("#saveOption").val("save");
       });
      //apply cashcard button
      $("#applyCC").click(function(){
       
        $("#dialog").dialog("open");
        $("#saveOption").val("applyCC");
     });
     //edit button
     $("#edit").click(function(){
         $('#tabs :input').removeAttr('disabled');
    });
    
    //Fill the customer drop down
      GetLookUp('region','country','country');    
      GetLookUp('region','currMailCountry','country');
      GetLookUp('region','permAddCountry','country');
      GetLookUp('region','busAddCountry','country');
      GetLookUp('country','curState','state');
      GetLookUp('country','permAddState','state');
      GetLookUp('country','busAddState','state');
    
}
    
</script>

    
<form method="post"  id="custForm">
    <input type="hidden" id="saveOption" name="saveOption"/>
    <div id="dialog" title="Add Customer">
        <p>Are you sure you want to add this customer?</p>
    </div>
    <div id="tabs">
    <ul>
        <li ><a href="#tab1">Customer Classification</a></li>
        <li ><a href="#tab2">Lead Source</a></li>
        <li ><a href="#tab3">Personal Information</a></li>
        <li ><a href="#tab4">Work and Finances</a></li>
        <li ><a href="#tab5">Additional Information</a></li>
        <li ><a href="#tab6">Contanct Permission</a></li>
    </ul> 
   
    <div id="tab1">
        <ol>
       <li><label>CUSTOMER ID:</label><input type="text" size="20" value="@custId"/></li>
        <li><label>CUSTOMER CLASSIFICATION:</label>
        <select id="custClass" name="custClass" >
            @foreach(var r in Page.CustClass){
                 if(r.RefID.Equals(@customer.CustomerClassification)){
                   <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID" >@r.RefDesc</option>
                }
              
            }
        </select></li>
        <li><label>CUSTOMER STATUS:</label>
        <select name="custStatus">
            @foreach(var r in Page.CustStatus){
                if(r.RefID.Equals(@customer.CustomerStatus)){
                   <option value="@r.RefID" selected="selected">@r.RefDesc</option>    
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
            }
        </select></li>
            </ol>
    </div> 
   
     <div id="tab2">
        <ol>
        <li><label>REGION:</label>
        <select name="region" id="region">
            @foreach(var r in Page.Region){
                if(r.RefID.Equals(@customer.Region)){
                  <option value="@r.RefID" selected="selected">@r.RefDesc</option>    
                }else{
                   <option value="@r.RefID">@r.RefDesc</option>  
                }
                
            }
        </select></li>
        <li><label>SOLICITOR:</label>
        <select name="solicitor" id="solicitor">
            @foreach(var r in Page.Solicitor){
                if(r.RefID.Equals(@customer.Solicitor)){
                      <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                      <option value="@r.RefID">@r.RefDesc</option>
                }
              
            }
        </select></li>
        <li><label>CAMPAIGN:</label>
        <select name="campaign">
            @foreach(var r in Page.Campaign){
                if(r.RefID.Equals(@customer.Campaign)){
                    <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
            }
        </select></li>
        <li><label>REFERRED BY:</label>
        <select name="refBy">
            @foreach(var r in Page.RefBy){
               if(r.CustomerID.Equals(@customer.ReferredBy)){
                  <option value="@r.CustomerID" selected="selected">@r.FName @r.LName</option>    
            } else{
                   <option value="@r.CustomerID">@r.FName @r.LName</option>
            }
            
            }
        </select></li>
            <li>
        <label>RELATIONSHIP TO REFERROR:</label>
        <select name="rel2ref">
            @foreach(var r in Page.Rel2Ref){
                if(r.RefID.Equals(@customer.RelToReferror)){
                      <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option> 
                }
                
            }
        </select></li>
            </ol>
        </div>
     
    <div id="tab3">
   <ol>
        <li><label>COUNTRY:</label>
            <select name="country" id="country">
              <option>---</option>
            
        </select></li>
      <li> <label>MONTH &amp; YEAR ARRIVED </label>
        <select name="monArr">
            @foreach(var r in Page.Month){
                if(r.RefID.Equals(@customer.MonArr)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select>
    
        <select name="yrArr">
            @foreach(var r in Page.Year){
                if(r.RefID.Equals(@customer.YearArrived)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
            
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
              } 
        </select></li>
        <li>
        <label>CUSTOMER NAME:</label>
        <input type="text" name="fname" value="@customer.FName" size="20"/>
        <input type="text" name="mname" value="@customer.MName" size="20"/>
        <input type="text" name="lname" value="@customer.LName" size="20"/>
            </li>
    <li>
        <label>GENDER:</label>
        <input type="radio" name="gender" value="m" checked="checked"/>Male
        <input type="radio" name="gender" value="f"/>Female
        </li>
    <li>
        <label>BIRTHDAY:</label>
        <input type="text" id="datepicker" value="@customer.Bdate" name="bdate"/>
        </li>
    <li>
        <label>NATIONALITY:</label>
        <select name="nationality">
            @foreach(var r in Page.Nationality){
               if(r.RefID.Equals(@customer.Nationality)){
                <option value="@r.RefID" selected="selected">@r.RefDesc</option>
            }else{
                <option value="@r.RefID">@r.RefDesc</option>
            } 
               
            }
        </select></li>
        <li><label>Place OF BIRTH:</label>
        <input type="text" name="pob" value="@customer.PlaceOfBirth"/></li>
        <li><label>MOTHER'S MAIDEN NAME:</label>
        <input type="text" name="mMName" value="@customer.MotherMName"/></li>
        <li><label>CIVIL STATUS:</label>
        <select name="civilStatus">
            @foreach(var r in Page.CivilStatus){
                if(r.RefID.Equals(@customer.CivilStatus)){
                    <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
            }
        </select></li>
        <li><label>ID PRESENTED:</label>
        <select name="idType">
            @foreach(var r in Page.IDType){
                if(r.RefID.Equals(@customer.IDType)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select></li>
        <li><label>ID NUMBER:</label>
        <input type="text" name="idNo" value="@customer.IDNumber"/></li>
        <li><label>MOBILE NO:</label>
        <input type="text" name="mobileCC"/>-<input type="text" name="mobileAC"/>-<input type="text" name="mobilePNo"/><label>(Country Code + Area Code + Phone No.</label>
        </li>
        <li><label>LANDLINE NO:</label>
        <input type="text" name="landLineCC"/>-<input type="text" name="landLineAC"/>-<input type="text" name="landLinePNo"/><label>(Country Code + Area Code + Phone No.</label>
        </li>
         <li><label>EMAIL ADDRESS:</label>
        <input type="text" name="email" value="@customer.Email"/>
        <li>
            <label>CURRENT MAILING ADDRESS</label></li>
            
        <li>
        <input type="text" name="currMailAdd1" value="@customer.CurrMailAdd"/><label>(Address1: Flat No., Room No., Building Name, Villa No.)</label></li>
        <li><input type="text" name="currMailAdd2"/><label>(Address2: Stree Name)</label></li>
        <li><input type="text" name="currMailCity" value="@customer.CurrMailCity"/><label>(City)</label></li>
        <li><label>(State)</label>
        <select name="currMailState" id="curState">
            <option>---</option>   
        </select>
         <label>(Country)</label>
       
         <select name="currMailCountry" id="currMailCountry">
            <option></option>
        </select>
       <label>Zipcode</label><input type="text" value="@customer.CurrMailZip" name="currMailZip"/>
            </li>
            <li>
        <label>PERMANENT  ADDRESS</label>  <input type="checkbox" name="sameAsMailAdd"/>
      </li>
            <li>
        <input type="text" name="permAdd1"/><label>(Address1: Flat No., Room No., Building Name, Villa No.)</label></li>
        <li><input type="text" name="permAdd2"/><label>(Address2: Stree Name)</label></li>
        <li><input type="text" name="permAddCity"/><label>(City)</label></li>
        <li><label>(State)</label>
        <select name="permAddState" id="permAddState">
          <option></option>
        </select>
         <label>(Country)</label>
       
         <select name="permAddCountry" id="permAddCountry">
           <option></option>
        </select>
       <label>Zipcode</label><input type="text" value="@customer.PermAddZip" name="permAddZip"/>
                </li>
    </ol>   
    </div>
       
        <div id="tab4">
            <ol>
                <li>
            <label>SOURCE OF FUNDS:</label>
             <select name="srcOfFunds">
            @foreach(var r in Page.SrcOfFund){
                if(r.RefID.Equals(@customer.SrcOfFunds)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select></li>
            <li>    
            <label>EMPLOYMENT:</label>
             <select name="employment">
            @foreach(var r in Page.EmpType){
                if(r.RefID.Equals(@customer.Employment)){
                  <option value="@r.RefID" selected="selected">@r.RefDesc</option>    
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
            }
            </select></li>
            <li><label>DESIGNATION / RANK:</label>
             <select name="desigRank">
            @foreach(var r in Page.DesigRank){
                if(r.RefID.Equals(@customer.Designation)){
                    <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                   <option value="@r.RefID">@r.RefDesc</option> 
                }
                
            }
            </select></li>
            <li><label>EMPLOYER / BUSINESS NAME:</label>
            <input type="text" name="busName"/></li>
            <li><label>NATURE OF WORK / BUSINESS NAME:</label>
            <select name="natureOfWork">
            @foreach(var r in Page.NatureOfWork){
                if(r.RefID.Equals(@customer.NatureOfWork)){
                    <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
            }
            </select></li>
            <li><label>LANDLINE NO:</label>
        <input type="text" name="busPhoneCC"/>-<input type="text" name="busPhoneAC"/>-<input type="text" name="busPhoneNo"/><label>(Country Code + Area Code + Phone No.</label>
        </li>
                
            <li><label>BUSINESS  ADDRESS</label></li>
        <li><input type="text" name="busAdd1"/><label>(Address1: Flat No., Room No., Building Name, Villa No.)</label></li>
        <li><input type="text" name="busAdd2"/><label>(Address2: Stree Name)</label></li>
        <li><input type="text" name="busAddCity"/><label>(City)</label></li>
        <li><label>(State)</label>
        <select name="busAddState" id="busAddState">
            <option></option>
        </select>
         <label>(Country)</label>
       
         <select name="busAddCountry" id="busAddCountry">
           <option></option>
        </select>
       <label>Zipcode</label><input type="text" value="@customer.BusZip" name="busAddZip"/></li>
                </ol>
        </div>
        
        <div id="tab5">
            <ol>
            <li><label>MODE OF REMITTANCE:</label>
         <select name="modeOfRemit">
            @foreach(var r in Page.ModeOfRemit){
                if(r.RefID.Equals(@customer.ModeOfRemit)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select></li>
            <li><label>CALL FREQUENCY:</label>
         <select name="callFreq">
            @foreach(var r in Page.CallFreq){
                if(r.RefID.Equals(@customer.CallFrequency)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select></li>
           <li> <label>CARGO FREQUENCY:</label>
         <select name="cargoFreq">
            @foreach(var r in Page.CargoFreq){
                if(r.RefID.Equals(@customer.CargoFrequency)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select></li>
           <li><label>REMITTANCE FREQUENCY:</label>
         <select name="remitReq">
            @foreach(var r in Page.RemitFreq){
                if(r.RefID.Equals(@customer.RemitFrequency)){
                    <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
            }
        </select></li>
            <li><label>MODE OF CALL:</label>
         <select name="modeOfCall">
            @foreach(var r in Page.ModeOfCall){
                if(r.RefID.Equals(@customer.ModeOfCall)){
                    <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                    <option value="@r.RefID">@r.RefDesc</option>
                }
                
                
            }
        </select></li>
                </ol>
        </div>
        
        <div id="tab6">
            <ol>
            <li><label>Allow to be contacted via:</label>
            <input type="checkbox" name="allowPhone" value="1"/>Phone
            <input type="checkbox" name="allowEmail" value="1"/>Email
            <input type="checkbox" name="allowFax" value="1"/>Fax
            <input type="checkbox" name="allowMail" value="1"/>Delivery Mail</li>
            
            <li><label>PREFERRED MODE OF COMMUNICATION</label>
            <select name="prefModeOfComm">
            @foreach(var r in Page.PrefModeOfComm){
                if(r.RefID.Equals(@customer.PrefModeOfComm)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
                
               
            }
        </select></li>
            <li><label>PREFERRED DAY TO BE CALLED</label>
            <select name="prefCallDay">
            @foreach(var r in Page.PrefDayOfCall){
                if(r.RefID.Equals(@customer.PreffCallDay)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
                
               
            }
        </select></li>
            <li><label>PREFERRED TIME TO BE CALLED</label>
            <select name="prefCallTime">
            @foreach(var r in Page.PrefTimeOfCall){
                if(r.RefID.Equals(@customer.PrefCallTime)){
                     <option value="@r.RefID" selected="selected">@r.RefDesc</option>
                }else{
                     <option value="@r.RefID">@r.RefDesc</option>
                }
               
            }
        </select></li>
                </ol>
            </div>
            
     </div>
    <br/>
     <div id="buttons" align="center">
       <input type="button" id="addCustomer"  value="SAVE"/>
       <input type="button" id="applyCC"  value="SAVE AND APPLY FOR CASH CARD"/>
       <input type="button" id="edit"  value="EDIT"/>
          
        
        </div>
    
</form>    
